package com.example.boot.controller;


import org.springframework.web.bind.annotation.*;

/**
 * @author shkstart
 * @creat 2021-04-01-下午2:33
 */
@RestController
public class RestController1 {
//    @RequestMapping(value = "/user",method = RequestMethod.GET)
    @GetMapping("/user")
    public String getUser(){
        return "GET-张三";
    }

//    @RequestMapping(value = "/user",method = RequestMethod.POST)
    @PostMapping("/user")
    public String saveUser(){
        return "POST-张三";
    }


    @RequestMapping(value = "/user",method = RequestMethod.PUT)
//当以后前端可以直接发put和delete请求，不用在使用post转换，可以使用下面注解，直接接受put请求

//    @PutMapping("/user")
    public String putUser(){
        return "PUT-张三";
    }

    @RequestMapping(value = "/user",method = RequestMethod.DELETE)
//    @DeleteMapping("/user")
    public String deleteUser(){
        return "DELETE-张三";
    }
}
